package com.dong.course.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dong.course.dto.CourseDTO;
import com.dong.course.service.ICourseService;
import com.dong.course.threadLocal.UserDTOThreadLocal;
import com.dong.thrift.user.dto.UserDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/course")
public class CourseController {
    @Reference(interfaceClass = ICourseService.class,timeout = 5000)
    private ICourseService courseService;
    @GetMapping("/list")
    public List<CourseDTO> listCourse() {
        UserDTO userDTO = UserDTOThreadLocal.threadLocalInstacne.get();
        System.out.println(userDTO);
        return courseService.courseList();
    }
}
